//
//  OptionTypeLabel.swift
//  GreenDeal
//
//  Created by Moennig Q on 22/2/2023.
//

import UIKit
class OptionTypeLabel: PaddingLabel{
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    convenience init(_ title: String, leftRightPadding: CGFloat = 8, topBottomPadding: CGFloat = 8) {
        self.init(frame: CGRect.zero)
        self.paddingTop = topBottomPadding
        self.paddingBottom = topBottomPadding
        self.paddingLeft = leftRightPadding
        self.paddingRight = leftRightPadding
        self.layer.cornerRadius = Constant.StandardCornerRadius
        self.clipsToBounds = true
        self.setFont(R.font.interRegular(size: 14))
        self.adjustsFontSizeToFitWidth = true
        self.text = title
        self.textAlignment = .center
        //默认不选择
        self.setUnSelect()
    }
    func setUnSelect(){
        self.tag = 0
        self.layer.borderWidth = 0
        self.layer.borderColor = UIColor.clear.cgColor
        self.backgroundColor = UIColor(hexStr: "#F5F5F5")
        self.textColor = UIColor(hexStr: "#292D32")
    }
    func setSelect(){
        self.tag = 1
        self.layer.borderWidth = 1
        self.layer.borderColor = UIColor(hexStr: Constant.ThemeColorHexStr).cgColor
        self.backgroundColor = UIColor(hexStr: "#005D2D1A")
        self.textColor = UIColor(hexStr: Constant.ThemeColorHexStr)
        
    }
}
